package cn.caplike.demo.repository.java;

import lombok.extern.slf4j.Slf4j;

/**
 * Description: 装箱和拆箱
 *
 * @author LiKe
 * @version 1.0.0
 * @date 2020-11-24 09:36
 */
@Slf4j
public class BoxingAndUnboxing {

    public static void main(String[] args) {
        Integer iObj = 5;
        int i = 5;
        log.info("iObj(5) == i: {}", iObj == i);
        iObj = null;

        try {
            log.info("i == iObj(null): {}", i == iObj);
        } catch (NullPointerException exception) {
            log.error("i == iObj(null): ", exception);
        }

        try {
            log.info("(null)iObj == i: {}", iObj == i);
        } catch (NullPointerException exception) {
            log.error("(null)iObj == i: ", exception);
        }
    }

}
